package com.es;

import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;

import com.es.listener.ConsumerEvnListener;
import com.es.web.tomcat.TomcatServletFactory;

@SpringBootApplication
@PropertySource(value = {"classpath:application.properties","classpath:jdbc.properties"}, ignoreResourceNotFound = true, encoding = "utf-8")
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class AppApplication {

	public static void main(String[] args) throws MQClientException, InterruptedException, RemotingException, MQBrokerException {
		SpringApplication app = new SpringApplication(AppApplication.class);
		//app.addListeners(new ConsumerEvnListener());
		app.run(args);
		
	}
    /**
     * tomcat优化
     * @return
     */
    @Bean
   public TomcatServletWebServerFactory tomcatServletWebServerFactory (){
	   
	   TomcatServletFactory factory = new TomcatServletFactory();
	  return factory;
   }
    
    



}
